package com.example.front.view;

import com.example.common.enums.ReCode;

import java.util.List;

/**
 * 统一应答结果
 * @Author cjk
 * @Date 2024 07 23 20 04
 **/
public class RespResult {
    private int code;
    private String msg;
    private Object data;
    private List list;
    private PageInfo page;
    public RespResult() {
    }

    public RespResult(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    //成功
    public static RespResult success(){
        RespResult respResult = new RespResult();
        respResult.setCode(ReCode.SUCC.code);
        respResult.setMsg("操作成功");
        return respResult;
    }
    //失败
    public static RespResult fail(){
        RespResult respResult = new RespResult();
        respResult.setCode(ReCode.FAil.code);
        respResult.setMsg("操作成功");
        return respResult;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public List getList() {
        return list;
    }

    public void setList(List list) {
        this.list = list;
    }

    public PageInfo getPage() {
        return page;
    }

    public void setPage(PageInfo page) {
        this.page = page;
    }
}
